import { safeNewDate } from '@src/util/time';
import i18n from '@src/locales'
export const PickerOptions = {
  shortcuts: [{
    text: i18n.t('task.components.taskAllotModal.today'),
    onClick(picker: any) {
      const end = safeNewDate();
      const start = safeNewDate();
      picker.$emit('pick', [start, end]);
    }
  }, {
    text: i18n.t('task.components.taskAllotModal.yesterday'),
    onClick(picker: any) {
      const end = safeNewDate();
      const start = safeNewDate();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 1);
      end.setTime(end.getTime() - 3600 * 1000 * 24 * 1);
      picker.$emit('pick', [start, end]);
    }
  }, {
    text: i18n.t('task.components.taskAllotModal.lastWeek'),
    onClick(picker: any) {
      const end = safeNewDate();
      const start = safeNewDate();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
      picker.$emit('pick', [start, end]);
    }
  }, {
    text: i18n.t('task.components.taskAllotModal.lastMonth'),
    onClick(picker: any) {
      const end = safeNewDate();
      const start = safeNewDate();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
      picker.$emit('pick', [start, end]);
    }
  }]
}